package collection;

import java.util.ArrayList;
import java.util.Collection;


public class CollectionDemo {
    public static void main(String[] args) {
        //Collection c = new HashSet();
        Collection c = new ArrayList();
        c.add("one");
        c.add("two");
        c.add("three");
        c.add("four");
        c.add("five");

        // 重复元素
        boolean b = c.add("one");
        System.out.println(b);
        System.out.println(c);

        // 集合的相关操作
        System.out.println(c.size());
        System.out.println(c.isEmpty());
        c.clear();
        System.out.println("集合已清空");
        System.out.println(c.size());
        System.out.println(c.isEmpty());
    }
}
